{% extends 'index.html' %}
{% block content %}
    电影
    <div class="card">
        <table class="table table-striped table-hover">
            <thead>

            <tr>
                <th></th>
                <th>#</th>
                <th>标题</th>
                <th>预览</th>
                <th>下载</th>
            </tr>
            </thead>
            {% for m in movies %}

                <tr>
                    <td></td>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ m.name }}</td>
                    <td><a href="/movie_detail?m3u8url={{ m.url }}"><img style="height: 150px" src="{{ m.img }}"> </a>
                    </td>
                    <td><a href="/downloadm3u8?m3u8url={{ m.url }}">下载</a></td>
                </tr>
                {#        {{ m.name }}#}
                {% if  forloop.last %}
                    <tr>
                        <td></td>
                        <td style="alignment: center">
                            <div style="float: left">
                                {% if movies %}
                                    {% if currentpage != 1 %}

                                        <a align="right" href="{% url 'movie' %}/{{ lastpage }}"
                                           style="alignment: right">
                                            <button>上一页{{ lastpage }}</button>
                                        </a>

                                    {% endif %}
                                {% endif %}

                        </td>
                        <td colspan="2" align="center">
                            <div>当前是第{{ currentpage }}页</div>
                        </td>
                        <td style="alignment: center">
                            <div style="float: right">
                                {% if movies %}
                                    {% if forloop.counter > 14 %}

                                        <a align="right" href="{% url 'movie' %}/{{ nextpage }}"
                                           style="alignment: right">
                                            <button>下一页{{ nextpage }}</button>
                                        </a>

                                    {% endif %}
                                {% endif %}
                            </div>
                        </td>
                    </tr>
                {% endif %}
            {% endfor %}
        </table>
    </div>
{% endblock %}